/**
 * 在 dataobj 中，寻找 keyname 的属性。keyname 包含了点符号
 */


export default function lookup (dataobj, keyname) {
  //console.log(dataobj, keyname);
  if (keyname != '.' && keyname.includes('.')) {
    let midtemp = dataobj;
    let arr = keyname.split('.');

    for (let i = 0, len = arr.length; i < len; i++) {
      let key = arr[i];
      if (midtemp[key]) {
        midtemp = midtemp[key];
      } else {
        return undefined;
      }
    }
    return midtemp;
  }
  return dataobj[keyname];
}
